package com.shigen.demo.penetration.controller;

import com.shigen.demo.dao.UserMapper;
import com.shigen.demo.entity.Result;
import com.shigen.demo.entity.User;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 渗透测试
 *
 * @author shigenfu
 * @date 2023/8/24 9:39 上午
 */

@RestController
@RequestMapping(value = "penetration")
public class PenetrationController {

    @Resource
    private UserMapper userMapper;

    @GetMapping(value = "test")
    public Result<List<User>> penetrationTest(@RequestParam(value = "id", defaultValue = "1", required = false) Long id) {
        List<User> users = userMapper.penetrationQuery(id);
        return Result.ok(users);
    }

    @GetMapping(value = "findById")
    public Result<User> findById(@RequestParam(value = "id", defaultValue = "1", required = false) Long id) {
        User user = userMapper.findById(id);
        return Result.ok(user);
    }

    @GetMapping(value = "findById1")
    public Result<User> findById1(@RequestParam(value = "id", defaultValue = "1", required = false) String id) {
        User user = userMapper.findById1(id);
        return Result.ok(user);
    }

    @GetMapping(value = "findById2")
    public Result<User> findById2(@RequestParam(value = "id", defaultValue = "1", required = false) String id) {
        User user = userMapper.findById2(id);
        return Result.ok(user);
    }

}
